﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ObjectForm.ascx.cs"
    Inherits="SalesManagement.Controls.List.ObjectForm" %>
<%@ Register Src="~/Controls/List/BankForm.ascx" TagName="WindowEditor" TagPrefix="uc" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<ext:Hidden runat="server" ID="txtObjectId" Text="">
</ext:Hidden>
<ext:Store ID="storeCity" runat="server">
    <Reader>
        <ext:JsonReader IDProperty="CityId">
            <Fields>
                <ext:RecordField Name="CityId" />
                <ext:RecordField Name="CityName" />
            </Fields>
        </ext:JsonReader>
    </Reader>
</ext:Store>
<ext:Store ID="storeGroup" runat="server">
    <Reader>
        <ext:JsonReader IDProperty="GroupId">
            <Fields>
                <ext:RecordField Name="GroupId" />
                <ext:RecordField Name="GroupName" />
            </Fields>
        </ext:JsonReader>
    </Reader>
</ext:Store>
<ext:Store ID="storeBank" runat="server">
    <Reader>
        <ext:JsonReader IDProperty="BankId">
            <Fields>
                <ext:RecordField Name="BankId" />
                <ext:RecordField Name="BankName" />
            </Fields>
        </ext:JsonReader>
    </Reader>
</ext:Store>
<ext:Store ID="storeBranch" runat="server">
    <Reader>
        <ext:JsonReader IDProperty="BranchId">
            <Fields>
                <ext:RecordField Name="BranchId" />
                <ext:RecordField Name="BranchName" />
            </Fields>
        </ext:JsonReader>
    </Reader>
</ext:Store>
<ext:Window ID="winDetails" runat="server" Title="Khách hàng - Nhà cung cấp" Icon="User"
    Width="600" Height="350" Frame="false" Modal="true" Hidden="true" Resizable="false"
    Closable="true" Layout="FormLayout" Padding="5">
    <Items>
        <ext:FormPanel ID="FormWindow" runat="server" Split="true" Frame="false" Header="false"
            LabelWidth="80" AutoHeight="true" Border="false" BodyStyle="background-color:transparent;"
            BodyBorder="false" Layout="FormLayout" MonitorValid="true">
            <Defaults>
                <ext:Parameter Name="Anchor" Value="99%">
                </ext:Parameter>
            </Defaults>
            <Items>
                <ext:Panel ID="pnlFlexEven" runat="server" Layout="HBoxLayout" LabelWidth="80" BodyStyle="background-color:transparent;"
                    Closable="true" BodyBorder="false" AnchorHorizontal="99%">
                    <Defaults>
                        <ext:Parameter Name="margins" Value="0 5 0 0" Mode="Value" />
                    </Defaults>
                    <LayoutConfig>
                        <ext:HBoxLayoutConfig Padding="2" Align="Middle" />
                    </LayoutConfig>
                    <Items>
                        <ext:TextField ID="txtID" runat="server" FieldLabel="Mã KH-NCC" AllowBlank="false"
                            Flex="1"/>
                        <ext:TextField ID="txtName" runat="server" FieldLabel="Tên KH-NCC" AllowBlank="false"
                            Flex="2"/>
                    </Items>
                </ext:Panel>
                <ext:Panel ID="Panel1" runat="server" Layout="HBoxLayout" LabelWidth="80" AnchorHorizontal="99%"
                    BodyStyle="background-color:transparent;" Closable="true" BodyBorder="false">
                    <Defaults>
                        <ext:Parameter Name="margins" Value="0 5 0 0" Mode="Value" />
                    </Defaults>
                    <LayoutConfig>
                        <ext:HBoxLayoutConfig Padding="2" Align="Middle" />
                    </LayoutConfig>
                    <Items>
                        <ext:TextField ID="txtAdress" runat="server" FieldLabel="Địa chỉ" Flex="2" AllowBlank="false"/>
                        <ext:TextField ID="txtTaxCode" runat="server" FieldLabel="MST" Flex="1" LabelWidth="50" />
                    </Items>
                </ext:Panel>
                <ext:Panel ID="Panel2" runat="server" Layout="HBoxLayout" LabelWidth="80" AnchorHorizontal="99%"
                    BodyStyle="background-color:transparent;" Closable="true" BodyBorder="false">
                    <Defaults>
                        <ext:Parameter Name="margins" Value="0 5 0 0" Mode="Value" />
                    </Defaults>
                    <LayoutConfig>
                        <ext:HBoxLayoutConfig Padding="2" Align="Middle" />
                    </LayoutConfig>
                    <Items>
                        <ext:TextField ID="txtPhone" runat="server" FieldLabel="Điện thoại" Flex="1" AllowBlank="false"/>
                        <ext:TextField ID="txtPhone2" runat="server" FieldLabel="ĐT 2" Flex="1" LabelWidth="50" />
                        <ext:TextField ID="txtMobile" runat="server" FieldLabel="Di động" Flex="1" LabelWidth="50" />
                    </Items>
                </ext:Panel>
                <ext:Panel ID="Panel3" runat="server" Layout="HBoxLayout" LabelWidth="80" AnchorHorizontal="99%"
                    BodyStyle="background-color:transparent;" Closable="true" BodyBorder="false">
                    <Defaults>
                        <ext:Parameter Name="margins" Value="0 5 0 0" Mode="Value" />
                    </Defaults>
                    <LayoutConfig>
                        <ext:HBoxLayoutConfig Padding="2" Align="Middle" />
                    </LayoutConfig>
                    <Items>
                        <ext:TextField ID="txtFax" runat="server" FieldLabel="Fax" Flex="1" LabelWidth="80" />
                        <ext:TextField ID="txtEmail" runat="server" FieldLabel="Email" LabelWidth="50" Flex="1" />
                        <ext:TextField ID="txtWebsite" runat="server" FieldLabel="Website" LabelWidth="50"
                            Flex="1" />
                    </Items>
                </ext:Panel>
                <ext:Panel ID="Panel5" runat="server" Layout="HBoxLayout" LabelWidth="80" AnchorHorizontal="99%"
                    BodyStyle="background-color:transparent;" Closable="true" BodyBorder="false">
                    <Defaults>
                        <ext:Parameter Name="margins" Value="0 5 0 0" Mode="Value" />
                    </Defaults>
                    <LayoutConfig>
                        <ext:HBoxLayoutConfig Padding="2" Align="Middle" />
                    </LayoutConfig>
                    <Items>
                        <ext:ComboBox ID="cboCity" runat="server" FieldLabel="Tỉnh/Thành" LabelWidth="80"
                            StoreID="storeCity" DisplayField="CityName" ValueField="CityId" Flex="6" Editable="false">
                        </ext:ComboBox>
                        <ext:ComboBox ID="cboBank" runat="server" FieldLabel="Ngân hàng" LabelWidth="80"
                            StoreID="storeBank" DisplayField="BankName" ValueField="BankId" Flex="5" Editable="false">
                        </ext:ComboBox>
                        <ext:Button ID="btnAddBank" runat="server" Icon="Add" Flex="1">
                            <DirectEvents>
                                <Click OnEvent="btnAddBank_Click" />
                            </DirectEvents>
                        </ext:Button>
                    </Items>
                </ext:Panel>
                <ext:Panel ID="Panel4" runat="server" Layout="HBoxLayout" LabelWidth="80" AnchorHorizontal="99%"
                    BodyStyle="background-color:transparent;" Closable="true" BodyBorder="false">
                    <Defaults>
                        <ext:Parameter Name="margins" Value="0 5 0 0" Mode="Value" />
                    </Defaults>
                    <LayoutConfig>
                        <ext:HBoxLayoutConfig Padding="2" Align="Middle" />
                    </LayoutConfig>
                    <Items>
                        <ext:TextField ID="txtBankAccount" runat="server" FieldLabel="Tài khoản NH" Flex="1" />
                        <ext:TextField ID="txtBandAddress" runat="server" FieldLabel="Địa chỉ NH" Flex="1" />
                    </Items>
                </ext:Panel>
                <ext:Panel ID="Panel7" runat="server" Layout="HBoxLayout" LabelWidth="80" AnchorHorizontal="99%"
                    BodyStyle="background-color:transparent;" Closable="true" BodyBorder="false">
                    <Defaults>
                        <ext:Parameter Name="margins" Value="0 5 0 0" Mode="Value" />
                    </Defaults>
                    <LayoutConfig>
                        <ext:HBoxLayoutConfig Padding="2" Align="Middle" />
                    </LayoutConfig>
                    <Items>
                        <ext:ComboBox ID="cboGroup" FieldLabel="Nhóm KH" runat="server" LabelWidth="80" StoreID="storeGroup"
                            DisplayField="GroupName" ValueField="GroupId" Flex="1" Editable="false">
                        </ext:ComboBox>
                        <ext:TextField ID="txtContactName" runat="server" FieldLabel="Người liên hệ" Flex="1" />
                    </Items>
                </ext:Panel>
                <ext:Panel runat="server" ID="plcheck" BodyStyle="background-color:transparent;"
                    BodyBorder="false" AnchorHorizontal="99%" Layout="HBoxLayout" LabelWidth="80">
                    <Defaults>
                        <ext:Parameter Name="margins" Value="0 5 0 90" Mode="Value" />
                    </Defaults>
                    <Items>
                        <ext:CheckboxGroup ID="grpCheck" runat="server" Flex="1">
                            <Items>
                                <ext:Checkbox ID="chkIsCustomer" runat="server" BoxLabel="Khách hàng" Checked="true"/>
                                <ext:Checkbox ID="chkIsProvider" runat="server" BoxLabel="Nhà cung cấp"/>
                            </Items>
                        </ext:CheckboxGroup>
                        <ext:ComboBox ID="cboBranch" Editable="false" FieldLabel="Chi nhánh" runat="server" LabelWidth="80" StoreID="storeBranch"
                            DisplayField="BranchName" ValueField="BranchId" Flex="1">
                        </ext:ComboBox>
                    </Items>
                </ext:Panel>
                <ext:Panel ID="Panel8" runat="server" Layout="HBoxLayout" LabelWidth="80" AnchorHorizontal="99%"
                    BodyStyle="background-color:transparent;" Closable="true" BodyBorder="false">
                    <Defaults>
                        <ext:Parameter Name="margins" Value="0 5 0 0" Mode="Value" />
                    </Defaults>
                    <LayoutConfig>
                        <ext:HBoxLayoutConfig Padding="2" Align="Middle" />
                    </LayoutConfig>
                    <Items>
                        <ext:TextArea ID="txtNote" runat="server" FieldLabel="Ghi chú" Height="50" Flex="1" />
                    </Items>
                </ext:Panel>
            </Items>
            <Listeners>
                <ClientValidation Handler="#{btnSave}.setDisabled(!valid);" />
            </Listeners>
        </ext:FormPanel>
    </Items>
    <Buttons>
        <ext:Button ID="btnSave" runat="server" Text="Lưu" Icon="Disk">
            <DirectEvents>
                <Click OnEvent="btnSave_Click">
                    <EventMask ShowMask="true" Msg="Đang lưu..." MinDelay="1000" />
                </Click>
            </DirectEvents>
        </ext:Button>
        <ext:Button ID="btnCancel" runat="server" Text="Thoát" Icon="Cancel">
            <Listeners>
                <Click Handler="#{winDetails}.hide();" />
            </Listeners>
        </ext:Button>
    </Buttons>
</ext:Window>
<uc:WindowEditor ID="WindowEditor" runat="server" />
